<!DOCTYPE html>
<html>
<head>
	<title></title>
	<!--[if lt IE 9]>
	<meta http-equiv="refresh" content="0;ie.html" />
	<![endif]-->

	<link rel="shortcut icon" href="__STATIC__/layout/favicon.ico">
   <link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
	<link href="__STATIC__/layout/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
	<link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
	<link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
	<link href="__STATIC__/layout/css/channel.css?v=4.1.0" rel="stylesheet">
      <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
	<script src="__STATIC__/layout/js/jquery.min.js"></script>
	<!-- Sweet Alert -->
	<link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
	<!-- Sweet alert -->
	<script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>
	<!-- layer javascript -->
	<script src="__STATIC__/layout/js/plugins/layer/layer.min.js"></script>
 <script src="__STATIC__/layout/js/plugins/layer/laydate/laydate.js"></script>
</head>
<body class="white-bg" style="color:#333;padding:3px;">
 <!-- 标题 -->
    <div class="page-heade">
        <h2 class="title_color text-center">我的收件箱</h2>
    </div>
    <!-- 标题 -->
<div class="ibox" >
	<div class="ibox-title" >
		<a href="{:url('index')}" class="btn btn-info {if $is_read!==null||$is_star!==null}btn-outline{/if} allInfo">所有信息</a>
		<a href="{:url('index',['is_read'=>0])}" class="btn btn-info {if $is_read!=='0'}btn-outline{/if} noreadInfo">未读的信息</a>
        <a href="{:url('index',['is_read'=>1])}" class="btn btn-info {if $is_read!=='1'}btn-outline{/if} readedInfo">已读的信息</a>
        <a href="{:url('index',['is_star'=>1])}" class="btn btn-info {if $is_star!=='1'}btn-outline{/if} as0teriskInfo">标星的信息</a>
        <a href="javascript:;" class="btn btn-info btn-outline markReaded">标记为已读</a>
        <a href="javascript:;" class="btn btn-info btn-outline markNoRead">标记为未读</a>
        <a href="javascript:;" class="btn btn-info btn-outline asterisk">标星</a>
        <a href="javascript:;" class="btn btn-info btn-outline CancelAsterisk">取消标星</a>
	</div>
	<div class="ibox-content">
		<form role="form" id="form1" class="form-inline" method="get" action="#">

			<div class="form-group ">
				<label for="type">业务类型</label>
				<select class="form-control select" id="type" name="lx">
					<option value="">全部</option>
					{volist name="lxs" id="row"}
					<option value="{$row.id}" {if $lx==$row.id}selected{/if}>{$row.title}</option>
					{/volist}
				</select>
			</div>&nbsp;
			<div class="form-group ">
				<label for="search2">编号</label>
				<input type="text" name="sn"  id="search2" class="form-control" size="10" value="{$sn}">
			</div>&nbsp;
			<div class="form-group ">
				<label for="search3">主题</label>
				<input type="text" name="title" value="{$title}" id="search3" class="form-control" size="10" >
			</div>&nbsp;
			<div class="form-group ">
				<label for="search4">部门</label>
				<input type="text" name="de_name" value="{$de_name}" id="search4" class="form-control" size="10">
			</div>&nbsp;
                <div class="form-group ">
                <label for="search5">发起人</label>
                <input type="text" name="fqr_name" value="{$fqr_name}" id="search5" class="form-control" size="10">
            </div>&nbsp;
             <div class="form-group ">
                <label for="search6">时间</label>
                 <div class="form-group">
            <input type="text" id="start" placeholder="开始日期" class="form-control layer-date " style="min-width:120px;width:120px;display: inline-block;" name="start" value="{$start}">
           </div>
            <div class="form-group">
                至
            </div>
           <div class="form-group">
            <input type="text" class="form-control layer-date"  placeholder="结束日期" style="min-width:120px;width:120px;display: inline-block;" id="end" name="end" value="{$end}">
           </div>
            </div>
                <button class="btn btn-info" type="submit">查询</button>
            <button class="btn btn-info" type="reset" id="reset">清空查询条件</button>
		</form>
		<script>
			$(function () {
//			    重置
				$('#reset').on('click',function () {
					$(this).closest('form').find('input[type=text]').val('')
					$(this).closest('form').find('select').val('')
					$(this).closest('form').submit()
					return false
                })
                /*tabel复选框操作*/
                $("#checkall").click(function(){

                    $("[name=items]:checkbox").prop("checked",$(this).prop("checked"));
                    if( $("[name=items]:checkbox").prop("checked")!=true){
                        // console.log($(this))
                        $("[name=items]:checkbox").parents("tr").css("backgroundColor","#fff")
                    }else{
                        $("[name=items]:checkbox").parents("tr").css("backgroundColor","#f8f800")

                    }
                })
                $("[name=items]:checkbox").click(function(){
                    //定义一个临时变量，避免重复使用同一个选择器选择页面中的元素，提高程序效率
                    var $tmp = $("[name=items]:checkbox");
                    if($(this).prop("checked")!=true){
                        $(this).parent().parent().css("backgroundColor","#fff")
                    }else{
                        $(this).parent().parent().css("backgroundColor","#f8f800")
                    }
                    //用filter()方法筛选出选中的复选框，并直接给CheckedAll赋值
                    $("#checkAll").prop('checked',$tmp.length==$tmp.filter(':checked').length);

                })

                /*设置所属省份*/
                $(".setProvice").click(function(){
                    // $("#alert_addNewZone").show();
                    var $items=$("[name=items]:checkbox")

                    if( $items.filter(':checked').length<1){
                        sweetAlert("", "请选择城市！","error");
                    }else{
                        var arr = []
                        $items.filter(':checked').each(function (idx,o) {
							arr.push($(o).val())
                        })
						arr = arr.join('-')
                        //iframe层-父子操作
                        layer.open({
                            type: 2,
                            title: '批量设置所在分区',
                            area: ['500px', '400px'],
                            fixed: false, //不固定
                            maxmin: true,
                            content: '{:url("setprovice")}?cities='+arr
                        });
                        return false
                    }
                });
            })
		</script>
	</div>
	<div class="padding-10">
		<table class="table table-striped table-bordered table-hover bud_hei text-center" id="editable">
			<tr class="info">
				<th class="text-center"><input type="checkbox" id="checkall"></th>
				<th class="text-center">No</th>
				<th class="text-center">类型</th>
				<th class="text-center">编号</th>
				<th class="text-center">主题</th>
				<th class="text-center">部门/发起人</th>
				<th class="text-center">抄送时间</th>
			</tr>
			<tbody>
			{volist name="data" id="row" key="k"}
			<tr class="gradeX">
				<td><input type="checkbox" name="items" value="{$row.id}"></td>
				<td>{$k+((request()->param('page')?request()->param('page'):1)-1)*10}</td>
				<td>{$row.lxmc}</td>
				<td><a href="{:url('view',['id'=>$row.id])}">{$row.sn}</a></td>
				<td class="text-left">{$row.title}</td>
				<td>{$row.de_name}/{$row.fqr_name}</td>
				<td>{$row.cssj}</td>
			</tr>
			{/volist}
			</tbody>

		</table>
	</div>

</div>
</body>
</html>
<script>

     //日期范围限制
        var start = {
            elem: '#start',
            format: 'YYYY-MM-DD',
            min: laydate.now(), //设定最小日期为当前日期
            max: '2099-06-16 23:59:59', //最大日期
            istime: true,
            istoday: false,
            choose: function (datas) {
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };
        var end = {
            elem: '#end',
            format: 'YYYY-MM-DD',
            min: laydate.now(),
            max: '2099-06-16 23:59:59',
            istime: true,
            istoday: false,
            choose: function (datas) {
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };
        laydate(start);
        laydate(end);
  /*  $(function () {
        //新增
        $('#new').on('click',function () {

            //iframe层-父子操作
            layer.open({
                type: 2,
                title: '新增',
                area: ['500px', '400px'],
                fixed: false, //不固定
                maxmin: true,
                content: '{:url("addview")}'
            });
            return false

        })

		//修改
		$('.xiugai').on('click',function () {
            var id = $(this).data('id')
            //iframe层-父子操作
            layer.open({
                type: 2,
                title: '修改',
                area: ['500px', '400px'],
                fixed: false, //不固定
                maxmin: true,
                content: '{:url("updateview")}?id='+id
            });
            return false
        })

		//删除
        $('.shanchu').click(function () {
            var id = $(this).data('id')
            swal({
                title: "您确定要删除这条信息吗",
                text: "删除后将会出现在回收站！",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "删除",
                closeOnConfirm: false
            }, function () {
                $.ajax({
                    'type':'post',
                    'url':'{:url("delete")}',
                    'data':{'id':id},
                    'dataType':'json',
                    'success':function (data) {
                        if(data.success){
                            location.reload()
                        }else
                            swal(data.msg, "", "error");
                    }
                })

            });
        });

    })*/
/*标记为已读*/
$(".markReaded").click(function(){
     var $items=$("[name=items]:checkbox")
    if($items.filter(':checked').length<1){
		sweetAlert("", "请选择需要标记为已读的数据！","error");
    }else{
		var arr = []
		$items.filter(':checked').each(function (idx,o) {
			arr.push($(o).val())
		})
        $.post('{:url("mark_read")}',{type:1,data:arr},function (data) {
			if(data.success){
				swal({title:data.msg},function () {
					location.reload()
                })
			}else{
				swal(data.msg,'','error')
			}
        },'json')
		return false
    }
})
/*标记为未读*/
$(".markNoRead").click(function(){
     var $items=$("[name=items]:checkbox")
    if($items.filter(':checked').length<1){
         sweetAlert("", "请选择需要标记为未读的数据！","error");
    }else{
		var arr = []
		 $items.filter(':checked').each(function (idx,o) {
			 arr.push($(o).val())
		 })
        $.post('{:url("mark_read")}',{type:0,data:arr},function (data) {
            if(data.success){
                swal({title:data.msg},function () {
                    location.reload()
                })
            }else{
                swal(data.msg,'','error')
            }
        },'json')
        return false
    }
})
/*标星*/
$(".asterisk").click(function(){
     var $items=$("[name=items]:checkbox")
    if($items.filter(':checked').length<1){
         sweetAlert("", "请选择需要标星的数据！","error");
    }else{
        var arr = []
        $items.filter(':checked').each(function (idx,o) {
            arr.push($(o).val())
        })
        $.post('{:url("mark_star")}',{type:1,data:arr},function (data) {
            if(data.success){
                swal({title:data.msg},function () {
                    location.reload()
                })
            }else{
                swal(data.msg,'','error')
            }
        },'json')
        return false
    }
})

/*取消标星*/
$(".CancelAsterisk").click(function(){
     var $items=$("[name=items]:checkbox")
    if($items.filter(':checked').length<1){
         sweetAlert("", "请选择需要取消标星的数据！","error");
    }else{
        var arr = []
        $items.filter(':checked').each(function (idx,o) {
            arr.push($(o).val())
        })
        $.post('{:url("mark_star")}',{type:0,data:arr},function (data) {
            if(data.success){
                swal({title:data.msg},function () {
                    location.reload()
                })
            }else{
                swal(data.msg,'','error')
            }
        },'json')
        return false
    }
})



</script>